package com.zxlspace.thread;

/**
 * 测试优先级
 * 优先级高低代表概率大小
 */
public class TestPriority {

    public static void main(String[] args) {
        MyThread1 thread1 = new MyThread1();
        Thread t1 = new Thread(thread1, "t1");
        Thread t2 = new Thread(thread1, "t2");
        //设置优先级
        t1.setPriority(Thread.MIN_PRIORITY); //最低优先级
        t2.setPriority(Thread.MAX_PRIORITY); //最高优先级
        t1.start();
        t2.start();
    }
}
